//
//  WebServicesUtils.h
//  Bus
//
//  Created by wangjiajia on 13-7-10.
//  Copyright (c) 2013年 wangjiajia. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ASIHTTPRequestDelegate.h"
//接口访问工具类
@interface WebServicesUtils : NSObject{
    //static const int var = 5; #define var 5  enum { var = 5 };
    //static const int Default_Page_Size=12;
}

//类型名可以是 enum _NewsType 、 NewsType
typedef enum _NewsType{
    InNews=1,
    Notice=2,
    OneDay=3
} NewsType;

//登录
+(id)checkLogin:(NSString *)userName andPass:(NSString *) password;
//如果是同步请求，则把请求放在一个子线程中，返回的结果在子线程处理并返回（如Android版本）
//如果是异步请求，返回的结果需要放在代理中处理
+(ASIHTTPRequest*)checkLogin:(NSString *)username andPass:(NSString *)password withDelegate:(id <ASIHTTPRequestDelegate>) delegate;

#pragma mark-
#pragma mark-?优化点1:如果快速返回，则需要在viewWillDisappear里，把刚刚的未完成请求取消，避免对其他请求产生干扰 
//1、快速返回后，请求还未结束，当请求结束时，调用delegate的回调方法，此时代理已经销毁，造成Bad_Access
//2、由于代理没有调用viewWillUnload 说明不是代理已销毁，那么就是在回调代理方法时，方法内部的 变量被销毁或未初始化 或者 里面调用的方法所需资源不存在等，照成Bad_Access
//3、更倾向于第二种解释，解决方法就是在返回时，将上一个请求在viewWillDisappear 结束掉
//4、将请求返回void均改为ASIHTTPRequest


#pragma mark - 获取新闻 内部新闻1 通知公告2 公交一天3
+(ASIHTTPRequest*)getNewsInfoPageIndex:(NSInteger)pageIndex andPageSize:(NSInteger)pageSize newsType:(NewsType) type withDelegate:(id<ASIHTTPRequestDelegate>) delegete;
#pragma mark -根据ID获取新闻详情
+(ASIHTTPRequest*)getNewInfoByID:(int)articleID withDelegete:(id<ASIHTTPRequestDelegate>)delegate;

#pragma  mark- 获取财务信息
+(ASIHTTPRequest*)getProfit:(int)year andMonth:(int)month withDelege:(id<ASIHTTPRequestDelegate>)delegate;

#pragma mark- 获取工作汇报时间
+(ASIHTTPRequest*)getRepTimeList:(int)pageFor andPageSize:(int )pageSize withDelegate:(id<ASIHTTPRequestDelegate>) delegate;

#pragma mark- 获取汇报部门
+(ASIHTTPRequest*)getRepDepList:(NSString*) repTime withDelegate:(id<ASIHTTPRequestDelegate>) delegate;


#pragma mark- 根据ID获取汇报详情
+(ASIHTTPRequest*)getRepDetailByID:(int)repID withDelegete:(id<ASIHTTPRequestDelegate>)delegate;

#pragma mark- -------工作流部分--------

#pragma mark- 获取表单类型
+(ASIHTTPRequest*)getWFFormWithDelegate:(id<ASIHTTPRequestDelegate>)delegate;

#pragma  mark- 获取用户分页表单数据
+(ASIHTTPRequest*)getUserFormByUserID:(int)userId andFormName:(NSString*)formName andState:(NSString*)state andPageFor:(int)pageFor andPageSize:(int)pageSize withDelegete:(id<ASIHTTPRequestDelegate>)delegate;
#pragma mark- 根据ID获取表单内容
+(ASIHTTPRequest*)getUserFormByID:(int)Id andState:(NSString*) state withDelegete:(id<ASIHTTPRequestDelegate>)delegate;
#pragma mark- 获取只读表单(相当于exec,名称更亲切而已)
+(ASIHTTPRequest*)getReadOnlyFormName:(NSString*) execSql withDelegete:(id<ASIHTTPRequestDelegate>)delegate;

#pragma mark- 保存
+(ASIHTTPRequest*)processSave:(NSString*) formId andUserId:(int)userId andUserName:(NSString*)userName andFileContent:(NSString*) fileContent andSpContent:(NSString*)spContent withDelegete:(id<ASIHTTPRequestDelegate>)delegate;
#pragma mark- 保存并通过
+(ASIHTTPRequest*)processSaveAndPass:(NSString*) formId andUserId:(int)userId andUserName:(NSString*)userName andFileContent:(NSString*) fileContent andSpContent:(NSString*)spContent withDelegete:(id<ASIHTTPRequestDelegate>)delegate;
#pragma mark- 保存并驳回
+(ASIHTTPRequest*)processSaveAndReject:(NSString*) formId andUserId:(int)userId andUserName:(NSString*)userName andFileContent:(NSString*) fileContent andSpContent:(NSString*)spContent withDelegete:(id<ASIHTTPRequestDelegate>)delegate;

#pragma mark- exec (单条数据有[])
+(ASIHTTPRequest*)getExec:(NSString*) execSql andTag:(int)tag withDelegete:(id<ASIHTTPRequestDelegate>)delegate;
#pragma mark- execsingle (单条数据没有[])
+(ASIHTTPRequest*)getExecSingle:(NSString*) execSql andTag:(int)tag withDelegete:(id<ASIHTTPRequestDelegate>)delegate;

#pragma mark-processSubmit
+(ASIHTTPRequest*)processSubmit:(NSString *)formId andUserId:(NSString *)userId andUserName:(NSString*)userName andJbrUserId:(NSString*)jbrUserId andJbrUserName:(NSString*)jbrUserName andSelectNodeValue:(NSString *)selectNodeValue withDelegete:(id<ASIHTTPRequestDelegate>)delegate;
#pragma mark-processReject
+(ASIHTTPRequest*)processReject:(NSString *)formId andUserId:(NSString *)userId andUserName:(NSString*)userName andJbrUserId:(NSString*)jbrUserId andJbrUserName:(NSString*)jbrUserName andSelectNodeValue:(NSString *)selectNodeValue withDelegete:(id<ASIHTTPRequestDelegate>)delegate;

#pragma mark-processReject
+(ASIHTTPRequest*)processWt:(NSString *)formId andUserId:(NSString *)userId andUserName:(NSString*)userName andWtUserId:(NSString*)wtUserId andWtUserName:(NSString*)wtUserName withDelegete:(id<ASIHTTPRequestDelegate>)delegate;

@end
